<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <textarea cols="60" rows="25"></textarea>

  <script>
    var area = document.querySelector('textarea');
    area.value = localStorage.getItem('message') || '';
    area.addEventListener('input', function() {
      localStorage.setItem('message', area.value);
    });
  </script>
</body>
</html>
